package com.heima.comment.controller;

import com.heima.comment.dto.CommentRayLikeDto;
import com.heima.comment.dto.CommentRepayDto;
import com.heima.comment.dto.CommentRepaySaveDto;
import com.heima.comment.serivce.IApCommentRepayService;
import com.heima.common.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 评论回复控制器
 *
 * @Author : wuqiang
 * @since : 2022-10-17
 */
@RestController
@RequestMapping("api/v1/comment_repay")
public class ApCommentRepayController {

    @Autowired
    private IApCommentRepayService apCommentRepayService;

    /**
     * 保存回复评论
     *
     * @param dto dto
     * @return {@link ResponseResult}
     */
    @PostMapping("/save")
    public ResponseResult saveCommentRepay(@RequestBody CommentRepaySaveDto dto) {
        return apCommentRepayService.saveCommentRepay(dto);
    }

    /**
     * 评论列表查询
     *
     * @param dto dto
     * @return {@link ResponseResult}
     */
    @PostMapping("/load")
    public ResponseResult loadCommentRepay(@RequestBody CommentRepayDto dto) {
        return apCommentRepayService.loadCommentRepay(dto);
    }

    /**
     * 评论回复点赞
     *
     * @param dto dto
     * @return {@link ResponseResult}
     */
    @PostMapping("/like")
    public ResponseResult likeCommentRepay(@RequestBody CommentRayLikeDto dto) {
        return apCommentRepayService.likeCommentRepay(dto);
    }

}
